package com.xiaoxing.zhinenghuacangku_jining.mvp.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.xiaoxing.zhinenghuacangku_jining.R;

import java.util.List;

public class JiNing_ProductsAdapter extends ArrayAdapter {

    private int resourceId;
    private Context mContext = null;
    private LayoutInflater mInflater = null;
    private ViewHolder holder = null;

    public JiNing_ProductsAdapter(Context context, int resource, List objects) {
        super(context, resource, objects);
        resourceId = resource;
        mContext = context;
        this.mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        if (convertView == null) {
            holder = new ViewHolder();
            convertView = mInflater.inflate(R.layout.zhi_neng_cang_ku_ji_ning_item_projects, null);
            holder.txt_title = (TextView) convertView.findViewById(R.id.tv_project_name);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        String str = getItem(position).toString();
        holder.txt_title.setText(str);

        return convertView;
    }

    private class ViewHolder {
        TextView txt_title;
    }

}
